#!/bin/bash

# SED SUBSTITUTION USING REGULAR EXPRESSION


# * replace the last two characters in every line of test_employee.txt
sed 's/..$/,Not Defined/' ./test_employee.txt
echo -e '\n'

# * delete the rest of the line starting from "Manager"
sed 's/Manager.*//' ./test_employee.txt # '.*' represent for matching any character except 'new line' with multiple times or 0 times.
echo -e '\n'

# * delete all lines that start with '#'
sed -e 's/#.*//' ./test_employee.txt
echo -e '\n'

# * delete all lines start with '#' and blank lines
sed -e 's/#.*// ; /^$/ d' ./test_employee.txt
echo -e '\n'

# * strip all thml tags from test.html
sed -e 's/<[^>]*>//g' ./test_webpage.html
echo -e '\n'


# * convert the DOS file format to Unix file format: 
#   DOS file format: new line is 'CR/LF'
#   Unix file format: \r\n
sed 's/ .$//' ./test_webpage.html

